<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>首页轮播图管理</title>
		<link rel="stylesheet" href="/adminSite/css/X-ui.css" />
		<link rel="stylesheet" href="/adminSite/css/article-xq.css" />
		<!--[if lt IE 9]>
			<script type="text/javascript" src="/adminSite/js/html5.js"></script>
		<![endif]-->
	</head>
	<body>
		<ol class="breadcrumb-nav">
			<li>
				<a href="">主页</a>
			</li>
			<li>
				轮播图管理
			</li>
		</ol>
		<div class="pd-20">
			<div class="pd-20">
					<% if(banner){ %>
						<table class="table table-h table-border table-bg table-bordered mt-20">
							<thead>
								<tr>
									<th style="width:50px">序号</th>
									<th>标题</th>
									<th>链接</th>
									<th style="width:150px">操作</th>
								</tr>
							</thead>
							<tbody class="text-c">
								<% banner.forEach(function(data , index){ %>
									<tr>
										<td><%= index+1 %></td>
										<td><%= data.title %></td>
										<td><%= data.url %></td>
										<td >
											<a href="">编辑</a>
											<a href="javascript:;" data-id="<%= data.id %>" class="delete-btn">删除</a>
										</td>
									</tr>
								<% }) %>
							</tbody>
						</table>
					<% }else{ %>
						<h2 class="text-c">您还未设置轮播图!</h2>
					<% } %>
			</div>
			<div class="pd-20">
				<a href="/admin/addBanner" class="btn">添加轮播</a>
			</div>
		</div>
		<script type="text/javascript" src="/adminSite/js/jquery-1.11.0.js" ></script>
		<script type="text/javascript" src="/adminSite/js/extend/X-ui-modal/js/X-ui-modal.js" ></script>
		<script>
			$(function(){
				$(".delete-btn").click(function(){
					$.post("/admin/delBanner" , {id:$(this).data("id")} , function(data){
						if(data.state == "ok"){
							XuiModal().msg("删除成功" , function(){
								window.location.reload();
							});
						}else{
							XuiModal().msg(data.message);
						};
					},"JSON");
				});
			});
		</script>
	</body>
</html>
